Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-41025: Add SDSS_65mm filter options to grating slot for LATISS. #473

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

edennihy
Copy link
Contributor

@edennihy edennihy commented Oct 5, 2023

No description provided.

@edennihy edennihy requested a review from timj October 5, 2023 22:01
@ktlim
Copy link
Contributor

ktlim commented Oct 5, 2023

Might be nice to filter out combinations that will never be used; right now the nested loops will make every combination.

@ktlim
Copy link
Contributor

ktlim commented Oct 5, 2023

Also, you have aliases for the filter in the filter wheel (new line 357); do you need aliases for the filter in the grating wheel?

@edennihy edennihy force-pushed the tickets/DM-41025 branch 2 times, most recently from 3d657d5 to e165117 Compare October 5, 2023 22:52
@edennihy
Copy link
Contributor Author

edennihy commented Oct 5, 2023

Do you have a suggestion for a quick way to filter out all of the (anticipated) unused combinations?

@edennihy
Copy link
Contributor Author

edennihy commented Oct 5, 2023

To your second point, I noticed the SDSS65mm filter definitions above did not have alias definitions, so I wasn't sure if that was needed. Same thing for the afw_name, unless those are being defined elsewhere. Although I just realized that new_alias definition will fail anyways since it is expecting a string..let me update that as well.

@edennihy
Copy link
Contributor Author

edennihy commented Oct 5, 2023

Okay, I added some simple logic to only allow the (empty~SDSS_65mm) combination and a check on the grating alias if needed.

@edennihy edennihy changed the title Add SDSS_65mm filter options to grating slot for LATISS. DM-41025: Add SDSS_65mm filter options to grating slot for LATISS. Oct 5, 2023
@timj
Copy link
Member

timj commented Oct 6, 2023

How many combinations do you end up with after this change?

$ butler create tmp
$ butler register-instrument tmp lsst.obs.lsst.Latiss
$ butler query-dimension-records tmp physical_filter

?

@edennihy
Copy link
Contributor Author

edennihy commented Oct 6, 2023

The total number of filters prior to change is 701, total number after is 707. The are a lot of combinations with the pinhole masks that we could filter as well if we want. For example, order blocking filters will not be used with the pinhole masks.

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs a bit of tidying up.

It's great that you managed to filter out all the combinations. I agree that another pass in the future to remove impossible combinations would be great.

@@ -325,6 +325,18 @@ def addFilter(filter_dict, band, physical_filter):
"pinhole_2_4_0500",
"pinhole_2_4_0200",
"pinhole_2_4_0100",
FilterDefinition(physical_filter="SDSSu_65mm",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment above this block explaining why these filters are nominally in the gratings list?

@@ -325,6 +325,18 @@ def addFilter(filter_dict, band, physical_filter):
"pinhole_2_4_0500",
"pinhole_2_4_0200",
"pinhole_2_4_0100",
FilterDefinition(physical_filter="SDSSu_65mm",
band="u"),
FilterDefinition(physical_filter="SDSSg_65mm",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry a bit that this duplication of class constructors with the filter list is going to leave us susceptible to typos in the future. Maybe we define a sdss_filters list and then use *sdss_filters in here and the filter list above? That would guarantee that we really are duplicating.

# FilterDefinition is a frozen dataclass
new_name = FILTER_DELIMITER.join([filter.physical_filter, grating])
if hasattr(grating, "physical_filter"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can do something like:

grating_name = getattr(grating, "physical_filter", grating)
new_name = FILTER_DELIMITER.join([filter.physical_filter, grating_name])

else:
new_aliases = {FILTER_DELIMITER.join([a, grating]) for a in filter.alias}

# For gratings set the band to the band of the filter. If an SDSS_65mm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is far more specific than the code that is written here. The comment should be talking about what happens if the grating is a filter definition. SDSS_65mm is never checked.

# filter is installed in the grating slot, define the band as the band
# of the SDSS_65mm filter.
if hasattr(grating, "band"):
combo = FilterDefinition(physical_filter=new_name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the above code is mainly working out the parameters for these calls, maybe use one isinstance instead to calculate the parameters instead of doing lots of hasattr tests?

@edennihy edennihy merged commit 32fff34 into main Oct 10, 2023
3 checks passed
@edennihy edennihy deleted the tickets/DM-41025 branch October 10, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants